<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>

<![endif]-->
<link href="static/h-ui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="static/h-ui.admin/css/H-ui.login.css" rel="stylesheet" type="text/css" />
<link href="static/h-ui.admin/css/style.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.8/iconfont.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>后台登录</title>
<meta name="keywords" content="">
<meta name="description" content="">
</head>
<body>
<script th:src="@{/js/vue-2.4.0.js}"></script>
<script th:src="@{/js/vue-resource-1.3.4.js}"></script>
<input type="hidden" id="TenantId" name="TenantId" value="" />
<!-- <div class="header"></div> -->
<div class="loginWraper" id="app">
  <div id="loginform" class="loginBox">
    <form class="form form-horizontal" >
      <div class="row cl">
        <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60d;</i></label>
        <div class="formControls col-xs-8">
          <input id="" name="" type="text" placeholder="账户" v-model="name" class="input-text size-L" value="a">
        </div>
      </div>
      <div class="row cl">
        <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60e;</i></label>
        <div class="formControls col-xs-8">
          <input id="" name="" type="password" placeholder="密码" v-model="password" class="input-text size-L" >
        </div>
      </div>
      <div class="row cl">
        <div class="formControls col-xs-8 col-xs-offset-3">
          <input class="input-text size-L" type="text" v-model="verification" placeholder="验证码" onblur="if(this.value==''){this.value='验证码:'}" onclick="if(this.value=='验证码:'){this.value='';}" value="验证码:" style="width:150px;">
          [{{auths}}] <a id="kanbuq" href="javascript:;" @click="verify">看不清，换一张</a> </div>
      </div>
      <div class="row cl">
        <div class="formControls col-xs-8 col-xs-offset-3">
          <label for="online">
            <input type="checkbox" name="online" id="online" value="">
            使我保持登录状态</label>
        </div>
      </div>
      <div class="row cl">
        <div class="formControls col-xs-8 col-xs-offset-3">
          <input name="" type="button" class="btn btn-success radius size-L" @click="enter"  value="登   录">
          <input name="" type="reset" class="btn btn-default radius size-L" value="取   消">
        </div>
      </div>
    </form>
  </div>
</div>
<div class="footer"></div>
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>

<script>
    var vm = new Vue({
        el:"#app",
        data:{
            auths:'',
            name:'',
            password:'',
            verification:''
        },
        created() {
            this.name="a"
            this.password="123456"
            this.verify()
        },
        methods: {
            enter(){
                if (this.name !=""&&this.password !="") {
                    if (this.verification.toLowerCase()==this.auths.toLowerCase()) {
                        this.$http.get("/verify_login", {
                            params: {
                                name: this.name,
                                password: this.password
                            }
                        }).then(function (result) {
                            if (result.body == true){
                                window.location = "/index"
                            }else if(result.body==null){
                                setTimeout(function () {
                                    layer.msg('该用户已过期!', {icon: 7, time: 1000});
                                },1500)
                            }else {
                                setTimeout(function () {
                                    layer.msg('密码或用户输入有误！', {icon: 7, time: 1000});
                                },1500)
                            }
                        })
                    } else {
                        setTimeout(function () {
                            layer.msg('验证码输入有误！请重新输入!', {icon: 7, time: 1000});
                        },1500)
                    }
                }else {
                    setTimeout(function () {
                        layer.msg('用户或密码不能为空！', {icon: 7, time: 1000});
                    },1500)
                }

            },
            verify(){
                this.$http.get("/verifys", {
                    params: {
                    }
                }).then(function (result) {
                   this.auths=result.data[0]
                })
            }
        }


    })

</script>
</body>
</html>